import { getShowString } from "../utils/mirUtil"
import { MoneyEnum } from "../配置/基础配置";



export function Main(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {
    let showNameList = [
        {
            name: '可视仓库',
            fucName: '可视仓库.Main'
        },
        {
            name: '挂机设置',
            fucName: '挂机.Main'
        },
        {
            name: '强化技能',
            fucName: '强化技能.Main'
        },
        {
            name: '鉴定',
            fucName: '鉴定.Main'
        },
        {
            name: '人物回血',
            fucName: '人物回血.Main'
        },
        {
            name: '人物属性',
            fucName: '鉴定.查看人物属性'
        },
        {
            name: '宝宝属性',
            fucName: '宝宝属性.Main'
        },
        // {
        //     name: '传送',
        //     fucName: '传送.Main'
        // },
        {
            name: '变性',
            fucName: '功能大全.变性'
        },
        {
            name: '元宝兑换金币',
            fucName: '功能大全.元宝兑换金币',
            hint: "1000元宝兑换1000W金币"
        },
        {
            name: '清理背包',
            fucName: '功能大全.清理背包'
        },
    ]

    let ItemsString = getShowString(showNameList);

    Npc.Say(Player, ItemsString)
}
export function 清理背包(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {
    Player.Question('确定清理背包吗?', '功能大全.确定清理背包', '');

}
export function 确定清理背包(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {
    for (let i = Player.MaxBagSize - 1; i >= 0; i--) //循环背包
    {
        let AItem: TUserItem = Player.GetBagItem(i); //取出一个背包物品 
        if (AItem) //如果物品存在
        {
            Npc.TakeItem(Player, AItem); //收走物品 
        }

    }
}


export function 变性(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {
    Player.Gender = Player.Gender === 0 ? 1 : 0
}

export function 元宝兑换金币(Npc: TNormNpc, Player: TPlayObject, Args: TArgs) {
    if (!Player.CanTakeGameMoney(MoneyEnum.GameGold, 1000)) {
        Player.MessageBox("你没有1000元宝")
        return
    }
    if (!Player.CanAddGameMoney(MoneyEnum.Gold, 10000000)) {
        Player.MessageBox("你金币过多,无法兑换")
        return
    }
    Player.TakeGameMoney(MoneyEnum.GameGold, 1000, "元宝兑换金币")
    Player.AddGameMoney(MoneyEnum.Gold, 10000000, "元宝兑换金币")
}